const mysql = require('mysql')

const con = mysql.createPool({
	host: '127.0.0.1',
	port: 3306,
	user: 'root',
	password: '3052959wyp.',
	database: '1904A_blogs'
})

function exec(sql, params) {
	return new Promise((resolve, reject) => {
		con.query(sql, params, (err, data) => {
			if (err) reject(err)
			resolve(data)
		})
	})
}

module.exports = {
	exec
}
